package com.example.shopping.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.shopping.model.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {

    // 统计总共有多少条记录
    @Select("select count(1) from accountrecord ")
    int countAll();

    // 获取所有记录
    @Select("select * from accountrecord limit #{pageNum},#{pageSize} ")
    List<Order> getAllOrder(@Param("pageNum") Integer pageNum,@Param("pageSize") Integer pageSize);


    @Select("select * from accountrecord where   ID> #{index}  limit 0,202000 ")
    List<Order> getAllOrder2(@Param("index") Integer index);

    @Insert(" insert into t_order (id,user_id,order_no) values (#{id},#{user_id},#{order_no})")
    int save(@Param("id") Long id, @Param("user_id") Integer user_id, @Param("order_no") String order_no, @Param("total_amount") Double total_amount);

}
